- introduce two new colors: $focus_border_color for focused / outlined elements and $_coloured_focus_border_color for focused / outlined elements with a colored background color, like suggested/destructive buttons or selected elements
- set outline / focus color, offset and style accordingly for all widgets
- adapt entry focus color
$checkradio_bg_color: if($variant == 'light', $selected_bg_color, lighten($selected_bg_color,10%));
$checkradio_fg_color: $selected_fg_color;
$checkradio_borders_color: if($variant == 'light', darken($checkradio_bg_color,20%), darken($checkradio_bg_color,40%));
+$focus_border_color: if($variant == 'light', transparentize($selected_bg_color, 0.5), transparentize($selected_bg_color, 0.3));
+$alt_focus_border_color: transparentize(white, 0.5);
$window_radius: $button_radius + 3;
$popover_radius: $button_radius + 4;
-button:focus(visible),
-checkbutton:focus(visible),
-radiobutton:focus(visible),
-switch:focus(visible),
-label:focus(visible),
-row:focus(visible),
-flowboxchild:focus(visible) {
- // We use the outline properties to signal the focus properties
- // to the adwaita engine: using real CSS properties is faster,
- // and we don't use any outlines for now.
-
- outline-color: gtkalpha(currentColor, 0.3);
- outline-style: dashed;
- outline-offset: -3px;
- outline-width: 1px;
-}
-
-// Widgets that draw their focus indicator outset and not inset
-scale:focus(visible) > trough {
- outline-color: gtkalpha(currentColor, 0.3);
- outline-style: dashed;
- outline-offset: 2px;
- outline-width: 1px;
-}
-
-
/***************
* Base States *
***************/
-gtk-icon-size: 32px;
}
+/*********
+ * Outlines *
+ ********/
+
+label:focus(visible),
+row:focus(visible),
+flowboxchild:focus(visible) {
+ // We use the outline properties to signal the focus properties
+ // to the adwaita engine: using real CSS properties is faster,
+ // and we don't use any outlines for now.
+
+ outline-color: $focus_border_color;
+ outline-style: solid;
+ outline-offset: -1px;
+ outline-width: 2px;
+ :selected & { outline-color: $alt_focus_border_color; }
+}
+
+// Widgets that draw their focus indicator outset and not inset
+scale:focus(visible) > trough {
+ outline-color: $focus_border_color;
+ outline-style: solid;
+ outline-offset: 10px;
+ outline-width: 2px;
+}
+
+button:focus(visible), modelbutton:focus(visible) {
+ outline-color: $focus_border_color;
+ outline-style: solid;
+ outline-offset: -2px;
+ outline-width: 2px;
+
+ row:selected & { outline-color: $alt_focus_border_color; }
+
+ &.suggested-action, &.destructive-action { &, &:hover, &:active { outline-color: $alt_focus_border_color; } }
+}
+
+// Draw the "outline" around the whole switch not the slider
+switch:focus(visible) {
+ &, &:hover { slider { outline-color: transparent; } }
+ &:focus {
+ box-shadow: 0 0 0 3px if($variant=='light', lighten(opacify($focus_border_color, 1), 20%), $focus_border_color);
+ }
+ row:selected & { outline-color: $alt_focus_border_color; }
+}
+
+checkbutton:focus(visible),
+radiobutton:focus(visible) {
+ outline-color: $focus_border_color;
+ outline-style: solid;
+ outline-offset: 1px;
+ outline-width: 2px;
+ row:selected & , treeview:selected & { outline-color: $alt_focus_border_color; }
+}
+
+row:focus(visible) {
+ outline-color: $focus_border_color;
+ outline-offset: -2px;
+ outline-style: solid;
+ &:selected {
+ outline-color: $alt_focus_border_color;
+ }
+}
+
+treeview:focus(visible) {
+ outline-color: $focus_border_color;
+ outline-style: solid;
+ outline-width: 2px;
+ &:selected {
+ outline-color: $alt_focus_border_color;
+ }
+}
+
+notebook:focus(visible) {
+ outline-color: $focus_border_color;
+ outline-style: solid;
+ outline-offset: -1px;
+ outline-width: 2px;
+}
+
/*
These wildcard seems unavoidable, need to investigate.
Wildcards are bad and troublesome, use them with care,
&:selected {
@extend %selected_items;
-
- outline-offset: -2px;
}
}
}
// child, a label needs just lateral padding while an icon needs vertical
// padding added too.
- outline-offset: -3px; // needs to be set or it gets overriden by GtkRadioButton outline-offset
-
> label {
padding-left: 6px; // label padding
padding-right: 6px; //
padding-left: 5px;
padding-right: 5px;
border-radius: $button_radius;
- outline-offset: -2px;
@extend %undecorated_button;
min-width: 30px;
padding: 3px 12px;
- outline-offset: -5px;
-
color: $insensitive_fg_color;
font-weight: bold;
switch {
font-weight: bold;
font-size: smaller;
- outline-offset: -4px;
// similar to the .scale
border: 1px solid $borders_color;
checkbutton.text-button, radiobutton.text-button {
// this is for a nice focus on check and radios text
padding: 2px 0;
- outline-offset: 0;
border-spacing: 4px;
}
// the backing bit
> trough {
@extend %scale_trough;
-
- outline-offset: 2px;
}
// the colored part of the backing bit
box-shadow: none;
text-shadow: none;
- outline-offset: -5px;
-
&:dir(ltr):not(:last-child) { margin-right: 0; }
&:dir(rtl):not(:last-child) { margin-left: 0; }
}
// entries
-@function entry_focus_border($fc:$selected_bg_color) {
- @if $variant == 'light' { @return $fc; }
- @else { @return if($fc==$selected_bg_color, $selected_borders_color, darken($fc, 35%)); }
+@function entry_focus_border($fc:$focus_border_color) {
+ @return $fc;
}
-@function entry_focus_shadow($fc:$selected_bg_color) { @return inset 0 0 0 1px $fc; }
+@function entry_focus_shadow($fc:$focus_border_color) { @return inset 0 0 0 1px $fc; }
-@mixin entry($t, $fc:$selected_bg_color, $edge: none) {
+@mixin entry($t, $fc:$focus_border_color, $edge: none) {
//
// Entries drawing function
//
// normal button
//
color: $tc;
- outline-color: transparentize($tc, 0.7);
border-color: if($c != $bg_color, _border_color($c), $borders_color);
border-bottom-color: if($c != $bg_color, _border_color($c, true), $alt_borders_color);
$button_fill: if($variant == 'light', linear-gradient(to top, darken($c, 4%) 2px, $c),
// hovered button
//
color: $tc;
- outline-color: transparentize($tc, 0.7);
border-color: if($c != $bg_color, _border_color($c), $borders_color);
border-bottom-color: if($c != $bg_color, _border_color($c, true), $alt_borders_color);
@if $variant == 'light' {
// normal button alternative look
//
color: $tc;
- outline-color: transparentize($tc, 0.7);
border-color: if($c != $bg_color, _border_color($c, true), $alt_borders_color);
@include _button_text_shadow($tc, $c);
@if $variant == 'light' {
// hovered button alternative look
//
color: $tc;
- outline-color: transparentize($tc, 0.7);
border-color: if($c != $bg_color, _border_color($c, true), $alt_borders_color);
@if $variant == 'light' {
$button_fill: linear-gradient(to bottom, lighten($c, 9%) 10%, lighten($c, 4%) 90%) !global;
// pushed button
//
color: $tc;
- outline-color: transparentize($tc, 0.7);
border-color: if($c != $bg_color, _border_color($c), $borders_color);
$button_fill: if($variant == 'light', image(darken($c, 14%)), image(darken($c, 9%))) !global;
background-image: $button_fill;
box-shadow: inset 0 1px transparentize(white, 0.9);
text-shadow: none;
-gtk-icon-shadow: none;
- outline-color: transparentize($osd_fg_color, 0.7);
}
@else if $t==osd-hover {
box-shadow: inset 0 1px transparentize(white, 0.9);
text-shadow: none;
-gtk-icon-shadow: none;
- outline-color: transparentize($osd_fg_color, 0.7);
}
@else if $t==osd-active {
box-shadow: none;
text-shadow: none;
-gtk-icon-shadow: none;
- outline-color: transparentize($osd_fg_color, 0.7);
}
@else if $t==osd-insensitive {